import type { RowType } from '#/views/${modulePath}/${businessPath}/${businessPath}.data';

import { requestClient } from '#/api/request';

export namespace ${className}TableApi {
  export type RowTypeFetchParams = RowType;
  export interface IdFetchParams {
    id: string;
  }
  export interface ListFetchParams {
    [key: string]: any;
  }
  export interface PageListFetchParams {
    [key: string]: any;
    pageNo: number;
    pageSize: number;
  }
}

/**
 * 分页列表查询
 */
export async function ${lowerClassName}QueryPageListApi(
  params: ${className}TableApi.PageListFetchParams,
) {
  return requestClient.get('/${modulePath}/${businessPath}/queryPageList', { params });
}

/**
 * 列表查询
 */
export async function ${lowerClassName}QueryListApi(params: ${className}TableApi.ListFetchParams) {
  return requestClient.get('/${modulePath}/${businessPath}/queryList', { params });
}

/**
 * 通过ID查询
 * @param params
 */
export async function ${lowerClassName}QueryByIdApi(params: ${className}TableApi.IdFetchParams) {
  return requestClient.get('/${modulePath}/${businessPath}/queryById', { params });
}

/**
 * 新增
 */
export async function ${lowerClassName}AddApi(params: ${className}TableApi.RowTypeFetchParams) {
  return requestClient.post('/${modulePath}/${businessPath}/add', params);
}

/**
 * 编辑
 */
export async function ${lowerClassName}EditApi(params: ${className}TableApi.RowTypeFetchParams) {
  return requestClient.post('/${modulePath}/${businessPath}/edit', params);
}

/**
 * 删除
 * @param id 主键
 */
export async function ${lowerClassName}DelApi(id) {
  return requestClient.delete<boolean>(`/${modulePath}/${businessPath}/delete/${delParams}`);
}

/**
 * 批量删除删除
 * @param ids 主键
 */
export async function ${lowerClassName}DeleteBatchApi(ids) {
  return requestClient.delete<boolean>(`/${modulePath}/${businessPath}/deleteBatchByIds/${delBatchParams}`,);
}
